package com.itheima.d2_reflect;

/*
     目标：获取Class对象。

     获取Class对象的三种方式
        1, Class c1 = 类名.class
        2, 调用Class提供方法：public static Class forName(String package)；
        3, Object提供的方法： public Class getClass()；  Class c3 = 对象.getClass();
 */
public class Test1Class {
    public static void main(String[] args) throws ClassNotFoundException {
        //1
        Class class1 = Cat.class;
        System.out.println(class1);
        //2
        Class<?> aClass = Class.forName("com.itheima.d2_reflect.Cat");
        System.out.println(aClass);
        System.out.println(aClass==class1);
        //3
        Cat cat = new Cat();
        Class catClass = cat.getClass();
        System.out.println(catClass==aClass);

        String name = catClass.getName();
        System.out.println(name);
        System.out.println(cat);
        String simpleName = class1.getSimpleName();
        System.out.println(simpleName);

    }


}

